/* eslint-disable @typescript-eslint/no-explicit-any */
// src/api/user.ts
import http from "./request";
import { User } from "../types/api";

export interface UserListParams {
  [key: string]: any;
}

export const getUser = (params: UserListParams): Promise<User[]> => {
  return http.request({
    url: "/user/getUser",
    method: "get",
    params,
  });
};

export const addUser = (data: Omit<User, "id">): Promise<User> => {
  return http.request({
    url: "/user/addUser",
    method: "post",
    data,
  });
};

export const updateUser = (data: User): Promise<User> => {
  return http.request({
    url: "/user/editUser",
    method: "post",
    data,
  });
};

export const deleteUser = (data: Pick<User, "id">): Promise<void> => {
  return http.request({
    url: "/user/deleteUser",
    method: "post",
    data,
  });
};
